package common

import "github.com/jiyeyuran/mediasoup-go/v2"

type Message struct {
	Cmd  string      `json:"cmd"`
	Rid  string      `json:"rid"`
	Data interface{} `json:"data"`
}

////////////////////////////////////////////////////////////////////////////////////////////////////

type ResMsgData struct {
	Code int         `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type ResMessage struct {
	Cmd  string     `json:"cmd"`
	Rid  string     `json:"rid"`
	Data ResMsgData `json:"data"`
}

////////////////////////////////////////////////////////////////////////////////////////////////////

const (
	LOGIN_REQ                = "loginReq"
	LOGIN_RES                = "loginRes"
	LOGIN_NOTIFY             = "loginNotify"
	LOGIN_ACK                = "loginAck"
	LOGOUT_REQ               = "logoutReq"
	LOGOUT_RES               = "logoutRes"
	LOGOUT_NOTIFY            = "logoutNotify"
	LOGOUT_ACK               = "logoutAck"
	CONNECTION_CLOSED_NOTIFY = "connClosedNotify"
	USER_OFFLINE_NOTIFY      = "userOfflineNotify"
)

type LoginReqData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type LoginResData struct {
	UserId string   `json:"user_id" mapstructure:"user_id"`
	Users  []string `json:"users" mapstructure:"users"`
}

type LoginNotifyData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type LoginAckData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type LogoutReqData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type LogoutResData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type LogoutNotifyData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type ConnClosedNotifyData struct {
	ConnId string `json:"conn_id" mapstructure:"conn_id"`
}

type UserOfflineNotifyData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
}

////////////////////////////////////////////////////////////////////////////////////////////////////

const (
	// General call message types
	CALL_MAKE_REQ    = "callMakeReq"
	CALL_MAKE_RES    = "callMakeRes"
	CALL_MAKE_NOTIFY = "callMakeNotify"
	CALL_MAKE_ACK    = "callMakeAck"
	CALL_END_REQ     = "callEndReq"
	CALL_END_RES     = "callEndRes"
	CALL_END_NOTIFY  = "callEndNotify"
	CALL_END_ACK     = "callEndAck"
)

type CallMakeReqData struct {
	CallerId string `json:"caller_id" mapstructure:"caller_id"` // User ID of the caller
	CallType string `json:"call_type" mapstructure:"call_type"` // "p2p" | "p2sp"
	CalleeId string `json:"callee_id" mapstructure:"callee_id"` // user_id | room_id
}

type CallMakeResData struct {
	CallerId string `json:"caller_id" mapstructure:"caller_id"` // User ID of the caller
	CallType string `json:"call_type" mapstructure:"call_type"` // "p2p" | "p2sp"
	CalleeId string `json:"callee_id" mapstructure:"callee_id"` // user_id | room_id
	CallId   string `json:"call_id" mapstructure:"call_id"`
}

type CallMakeNotifyData struct {
	CallType string `json:"call_type" mapstructure:"call_type"` // "p2p" | "p2sp"
	CallId   string `json:"call_id" mapstructure:"call_id"`
	CallerId string `json:"caller_id" mapstructure:"caller_id"` // user_id
	CalleeId string `json:"callee_id" mapstructure:"callee_id"` // user_id | room_id
}

type CallMakeAckData struct {
	CallType string `json:"call_type" mapstructure:"call_type"` // "p2p" | "p2sp"
	CallId   string `json:"call_id" mapstructure:"call_id"`
	CallerId string `json:"caller_id" mapstructure:"caller_id"` // user_id
	CalleeId string `json:"callee_id" mapstructure:"callee_id"` // user_id | room_id
}

type CallEndReqData struct {
	CallId string `json:"call_id" mapstructure:"call_id"` // Call ID
	UserId string `json:"user_id" mapstructure:"user_id"` // User ID of the person ending the call
}

type CallEndResData struct {
	CallId string `json:"call_id" mapstructure:"call_id"` // Call ID
	UserId string `json:"user_id" mapstructure:"user_id"` // User ID of the person ending the call
}

type CallEndNotifyData struct {
	CallId string `json:"call_id" mapstructure:"call_id"` // Call ID
	UserId string `json:"user_id" mapstructure:"user_id"` // Peer User ID
}

type CallEndAckData struct {
	CallId string `json:"call_id" mapstructure:"call_id"` // Call ID
	UserId string `json:"user_id" mapstructure:"user_id"` // Peer User ID
}

////////////////////////////////////////////////////////////////////////////////////////////////////

const (
	// P2P call message types
	P2P_CANDIDATE_NOTIFY     = "p2pCandidateNotify"
	P2P_NEGOTIATE_REQ        = "p2pNegotiateReq"
	P2P_NEGOTIATE_RES        = "p2pNegotiateRes"
	P2P_START_PUBLISH_REQ    = "p2pStartPublishReq"
	P2P_START_PUBLISH_RES    = "p2pStartPublishRes"
	P2P_START_PUBLISH_NOTIFY = "p2pStartPublishNotify"
	P2P_START_PUBLISH_ACK    = "p2pStartPublishAck"
	P2P_START_SUBSCRIBE_REQ  = "p2pStartSubscribeReq"
	P2P_START_SUBSCRIBE_RES  = "p2pStartSubscribeRes"
	P2P_START_PRODUCE_NOTIFY = "p2pStartProduceNotify"
	P2P_START_PRODUCE_ACK    = "p2pStartProduceAck"
	P2P_STOP_PUBLISH_REQ     = "p2pStopPublishReq"
	P2P_STOP_PUBLISH_RES     = "p2pStopPublishRes"
	P2P_STOP_PUBLISH_NOTIFY  = "p2pStopPublishNotify"
	P2P_STOP_PUBLISH_ACK     = "p2pStopPublishAck"
	P2P_STOP_SUBSCRIBE_REQ   = "p2pStopSubscribeReq"
	P2P_STOP_SUBSCRIBE_RES   = "p2pStopSubscribeRes"
	P2P_STOP_PRODUCE_NOTIFY  = "p2pStopProduceNotify"
	P2P_STOP_PRODUCE_ACK     = "p2pStopProduceAck"
)

type P2PCandidateNotifyData struct {
	CallId        string `json:"call_id" mapstructure:"call_id"`
	UserId        string `json:"user_id" mapstructure:"user_id"`
	SDPMid        string `json:"sdp_mid" mapstructure:"sdp_mid"`
	SDPMLineIndex int    `json:"sdp_mline_index" mapstructure:"sdp_mline_index"`
	Candidate     string `json:"candidate" mapstructure:"candidate"`
}

type P2PNegotiateReqData struct {
	CallId string `json:"call_id" mapstructure:"call_id"`
	UserId string `json:"user_id" mapstructure:"user_id"`
	SDP    string `json:"sdp" mapstructure:"sdp"`
}

type P2PNegotiateResData struct {
	CallId string `json:"call_id" mapstructure:"call_id"`
	UserId string `json:"user_id" mapstructure:"user_id"`
	SDP    string `json:"sdp" mapstructure:"sdp"`
}

type MediaInfo struct {
	MediaType string `json:"media_type" mapstructure:"media_type"`
	MediaId   string `json:"media_id" mapstructure:"media_id"`
	MediaName string `json:"media_name" mapstructure:"media_name"`
	SrcType   string `json:"src_type" mapstructure:"src_type"`
	SrcId     string `json:"src_id" mapstructure:"src_id"`
	SrcName   string `json:"src_name" mapstructure:"src_name"`
}

type P2PStartPublishReqData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStartPublishResData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStartPublishNotifyData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStartSubscribeReqData struct {
	CallId    string    `json:"call_id" mapstructure:"call_id"`
	UserId    string    `json:"user_id" mapstructure:"user_id"`
	PubUserId string    `json:"pub_user_id" mapstructure:"pub_user_id"`
	Media     MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStartSubscribeResData struct {
	CallId    string    `json:"call_id" mapstructure:"call_id"`
	UserId    string    `json:"user_id" mapstructure:"user_id"`
	PubUserId string    `json:"pub_user_id" mapstructure:"pub_user_id"`
	Media     MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStartProduceNotifyData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStartProduceAckData struct {
	CallId string `json:"call_id" mapstructure:"call_id"`
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type P2PStopPublishReqData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStopPublishResData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStopPublishNotifyData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type P2PStopPublishAckData struct {
	CallId string    `json:"call_id" mapstructure:"call_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

////////////////////////////////////////////////////////////////////////////////////////////////////

const (
	SFU_PREPARE_ROOM_REQ      = "sfuPrepareRoomReq"
	SFU_PREPARE_ROOM_RES      = "sfuPrepareRoomRes"
	SFU_JOIN_ROOM_REQ         = "sfuJoinRoomReq"
	SFU_JOIN_ROOM_RES         = "sfuJoinRoomRes"
	SFU_LEAVE_ROOM_REQ        = "sfuLeaveRoomReq"
	SFU_LEAVE_ROOM_RES        = "sfuLeaveRoomRes"
	SFU_START_PUBLISH_REQ     = "sfuStartPublishReq"
	SFU_START_PUBLISH_RES     = "sfuStartPublishRes"
	SFU_START_PUBLISH_NOTIFY  = "sfuStartPublishNotify"
	SFU_START_PUBLISH_ACK     = "sfuStartPublishAck"
	SFU_START_SUBSCRIBE_REQ   = "sfuStartSubscribeReq"
	SFU_START_SUBSCRIBE_RES   = "sfuStartSubscribeRes"
	SFU_STOP_PUBLISH_REQ      = "sfuStopPublishReq"
	SFU_STOP_PUBLISH_RES      = "sfuStopPublishRes"
	SFU_STOP_PUBLISH_NOTIFY   = "sfuStopPublishNotify"
	SFU_STOP_PUBLISH_ACK      = "sfuStopPublishAck"
	SFU_STOP_SUBSCRIBE_REQ    = "sfuStopSubscribeReq"
	SFU_STOP_SUBSCRIBE_RES    = "sfuStopSubscribeRes"
	SFU_CREATE_TRANSPORT_REQ  = "sfuCreateTransportReq"
	SFU_CREATE_TRANSPORT_RES  = "sfuCreateTransportRes"
	SFU_CONNECT_TRANSPORT_REQ = "sfuConnectTransportReq"
	SFU_CONNECT_TRANSPORT_RES = "sfuConnectTransportRes"
	SFU_START_PRODUCE_REQ     = "sfuStartProduceReq"
	SFU_START_PRODUCE_RES     = "sfuStartProduceRes"
	SFU_STOP_PRODUCE_REQ      = "sfuStopProduceReq"
	SFU_STOP_PRODUCE_RES      = "sfuStopProduceRes"
)

type SFUPrepareRoomReqData struct {
	UserId string `json:"user_id" mapstructure:"user_id"`
	RoomId string `json:"room_id" mapstructure:"room_id"`
}

type SFUPrepareRoomResData struct {
	RoomId  string                     `json:"room_id" mapstructure:"room_id"`
	UserId  string                     `json:"user_id" mapstructure:"user_id"`
	RtpCaps *mediasoup.RtpCapabilities `json:"rtp_caps" mapstructure:"rtp_caps"`
}

type SFUJoinRoomReqData struct {
	RoomId   string                      `json:"room_id" mapstructure:"room_id"`
	UserId   string                      `json:"user_id" mapstructure:"user_id"`
	RtpCaps  *mediasoup.RtpCapabilities  `json:"rtp_caps" mapstructure:"rtp_caps"`
	SctpCaps *mediasoup.SctpCapabilities `json:"sctp_caps" mapstructure:"sctp_caps"`
}

type ProducerInfo struct {
	ProducerId  string `json:"producer_id" mapstructure:"producer_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
	Kind        string `json:"kind" mapstructure:"kind"` // "audio" | "video"
	Paused      bool   `json:"paused" mapstructure:"paused"`
}

type UserInfo struct {
	UserId    string         `json:"user_id" mapstructure:"user_id"`
	Username  string         `json:"username" mapstructure:"username"`
	Producers []ProducerInfo `json:"producers" mapstructure:"producers"`
}

type SFUJoinRoomResData struct {
	RoomId string   `json:"room_id" mapstructure:"room_id"`
	UserId string   `json:"user_id" mapstructure:"user_id"`
	Users  []string `json:"users" mapstructure:"users"`
}

type SFULeaveRoomReqData struct {
	RoomId string `json:"room_id" mapstructure:"room_id"`
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type SFULeaveRoomResData struct {
	RoomId string `json:"room_id" mapstructure:"room_id"`
	UserId string `json:"user_id" mapstructure:"user_id"`
}

type SFUStartPublishReqData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStartPublishResData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStartPublishNotifyData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStartPublishAckData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStartSubscribeReqData struct {
	RoomId    string    `json:"room_id" mapstructure:"room_id"`
	UserId    string    `json:"user_id" mapstructure:"user_id"`
	PubUserId string    `json:"pub_user_id" mapstructure:"pub_user_id"`
	Media     MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStartSubscribeResData struct {
	RoomId        string                  `json:"room_id" mapstructure:"room_id"`
	UserId        string                  `json:"user_id" mapstructure:"user_id"`
	PubUserId     string                  `json:"pub_user_id" mapstructure:"pub_user_id"`
	Media         MediaInfo               `json:"media" mapstructure:"media"`
	ProducerId    string                  `json:"producer_id" mapstructure:"producer_id"`
	ConsumerId    string                  `json:"consumer_id" mapstructure:"consumer_id"`
	RtpParameters mediasoup.RtpParameters `json:"rtp_parameters" mapstructure:"rtp_parameters"`
	AppData       mediasoup.H             `json:"app_data" mapstructure:"app_data"`
}

type SFUStopPublishReqData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStopPublishResData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStopPublishNotifyData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStopPublishAckData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStopSubscribeReqData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUStopSubscribeResData struct {
	RoomId string    `json:"room_id" mapstructure:"room_id"`
	UserId string    `json:"user_id" mapstructure:"user_id"`
	Media  MediaInfo `json:"media" mapstructure:"media"`
}

type SFUCreateTransportReqData struct {
	RoomId        string                      `json:"room_id" mapstructure:"room_id"`
	UserId        string                      `json:"user_id" mapstructure:"user_id"`
	TransportType string                      `json:"transport_type" mapstructure:"transport_type"`
	ForceTcp      bool                        `json:"force_tcp" mapstructure:"force_tcp"`
	Producing     bool                        `json:"producing" mapstructure:"producing"`
	Consuming     bool                        `json:"consuming" mapstructure:"consuming"`
	SctpCaps      *mediasoup.SctpCapabilities `json:"sctp_caps" mapstructure:"sctp_caps"`
}

type SFUCreateTransportResData struct {
	RoomId         string                    `json:"room_id" mapstructure:"room_id"`
	UserId         string                    `json:"user_id" mapstructure:"user_id"`
	TransportType  string                    `json:"transport_type" mapstructure:"transport_type"`
	TransportId    string                    `json:"transport_id" mapstructure:"transport_id"`
	IceParameters  *mediasoup.IceParameters  `json:"ice_parameters" mapstructure:"ice_parameters"`
	IceCandidates  []mediasoup.IceCandidate  `json:"ice_candidates" mapstructure:"ice_candidates"`
	DtlsParameters *mediasoup.DtlsParameters `json:"dtls_parameters" mapstructure:"dtls_parameters"`
	SctpParameters *mediasoup.SctpParameters `json:"sctp_parameters" mapstructure:"sctp_parameters"`
}

type SFUConnectTransportReqData struct {
	RoomId         string                    `json:"room_id" mapstructure:"room_id"`
	UserId         string                    `json:"user_id" mapstructure:"user_id"`
	SendOrRecv     string                    `json:"send_or_recv" mapstructure:"send_or_recv"`
	TransportType  string                    `json:"transport_type" mapstructure:"transport_type"`
	TransportId    string                    `json:"transport_id" mapstructure:"transport_id"`
	DtlsParameters *mediasoup.DtlsParameters `json:"dtls_parameters" mapstructure:"dtls_parameters"`
}

type SFUConnectTransportResData struct {
	RoomId      string `json:"room_id" mapstructure:"room_id"`
	UserId      string `json:"user_id" mapstructure:"user_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
}

type SFUStartProduceReqData struct {
	RoomId        string                   `json:"room_id" mapstructure:"room_id"`
	UserId        string                   `json:"user_id" mapstructure:"user_id"`
	Media         MediaInfo                `json:"media" mapstructure:"media"`
	TransportId   string                   `json:"transport_id" mapstructure:"transport_id"`
	RtpParameters *mediasoup.RtpParameters `json:"rtp_parameters" mapstructure:"rtp_parameters"`
	AppData       mediasoup.H              `json:"app_data" mapstructure:"app_data"`
}

type SFUStartProduceResData struct {
	RoomId     string    `json:"room_id" mapstructure:"room_id"`
	UserId     string    `json:"user_id" mapstructure:"user_id"`
	Media      MediaInfo `json:"media" mapstructure:"media"`
	ProducerId string    `json:"producer_id" mapstructure:"producer_id"`
}

type SFUStopProduceReqData struct {
	RoomId     string    `json:"room_id" mapstructure:"room_id"`
	UserId     string    `json:"user_id" mapstructure:"user_id"`
	Media      MediaInfo `json:"media" mapstructure:"media"`
	ProducerId string    `json:"producer_id" mapstructure:"producer_id"`
}

type SFUStopProduceResData struct {
	RoomId     string    `json:"room_id" mapstructure:"room_id"`
	UserId     string    `json:"user_id" mapstructure:"user_id"`
	Media      MediaInfo `json:"media" mapstructure:"media"`
	ProducerId string    `json:"producer_id" mapstructure:"producer_id"`
}

////////////////////////////////////////////////////////////////////////////////////////////////////

const (
	// Media service message types
	REGISTER_SERVICE_REQ  = "registerServiceReq"
	REGISTER_SERVICE_RES  = "registerServiceRes"
	CREATE_ROUTER_REQ     = "createRouterReq"
	CREATE_ROUTER_RES     = "createRouterRes"
	CLOSE_ROUTER_REQ      = "closeRouterReq"
	CLOSE_ROUTER_RES      = "closeRouterRes"
	CREATE_TRANSPORT_REQ  = "createTransportReq"
	CREATE_TRANSPORT_RES  = "createTransportRes"
	CLOSE_TRANSPORT_REQ   = "closeTransportReq"
	CLOSE_TRANSPORT_RES   = "closeTransportRes"
	CONNECT_TRANSPORT_REQ = "connectTransportReq"
	CONNECT_TRANSPORT_RES = "connectTransportRes"
	CREATE_PRODUCER_REQ   = "createProducerReq"
	CREATE_PRODUCER_RES   = "createProducerRes"
	CLOSE_PRODUCER_REQ    = "closeProducerReq"
	CLOSE_PRODUCER_RES    = "closeProducerRes"
	CREATE_CONSUMER_REQ   = "createConsumerReq"
	CREATE_CONSUMER_RES   = "createConsumerRes"
	CLOSE_CONSUMER_REQ    = "closeConsumerReq"
	CLOSE_CONSUMER_RES    = "closeConsumerRes"

	UNKNOWN_MESSAGE_TYPE = "unknownMessageType"
)

type RegisterServiceReqData struct {
	ServiceType string `json:"service_type" mapstructure:"service_type"`
	ServiceId   string `json:"service_id" mapstructure:"service_id"`
	Workers     []int  `json:"workers" mapstructure:"workers"`
}

type CreateRouterReqData struct {
	ServiceId string `json:"service_id" mapstructure:"service_id"`
	WorkerId  int    `json:"worker_id" mapstructure:"worker_id"`
	RoomId    string `json:"room_id" mapstructure:"room_id"`
}

type CreateRouterResData struct {
	RouterId  string                     `json:"router_id" mapstructure:"router_id"`
	ServiceId string                     `json:"service_id" mapstructure:"service_id"`
	WorkerId  int                        `json:"worker_id" mapstructure:"worker_id"`
	RtpCaps   *mediasoup.RtpCapabilities `json:"rtp_caps" mapstructure:"rtp_caps"`
}

type CloseRouterReqData struct {
	RouterId  string `json:"router_id" mapstructure:"router_id"`
	ServiceId string `json:"service_id" mapstructure:"service_id"`
	WorkerId  int    `json:"worker_id" mapstructure:"worker_id"`
}

type CloseRouterResData struct {
	RouterId  string `json:"router_id" mapstructure:"router_id"`
	ServiceId string `json:"service_id" mapstructure:"service_id"`
	WorkerId  int    `json:"worker_id" mapstructure:"worker_id"`
}

type CreateTransportReqData struct {
	TransportType string                      `json:"transport_type" mapstructure:"transport_type"`
	RouterId      string                      `json:"router_id" mapstructure:"router_id"`
	ForceTcp      bool                        `json:"force_tcp" mapstructure:"force_tcp"`
	Producing     bool                        `json:"producing" mapstructure:"producing"`
	Consuming     bool                        `json:"consuming" mapstructure:"consuming"`
	SctpCaps      *mediasoup.SctpCapabilities `json:"sctp_caps" mapstructure:"sctp_caps"`
}

type CreateTransportResData struct {
	TransportType  string                    `json:"transport_type" mapstructure:"transport_type"`
	TransportId    string                    `json:"transport_id" mapstructure:"transport_id"`
	IceParameters  *mediasoup.IceParameters  `json:"ice_parameters" mapstructure:"ice_parameters"`
	IceCandidates  []mediasoup.IceCandidate  `json:"ice_candidates" mapstructure:"ice_candidates"`
	DtlsParameters *mediasoup.DtlsParameters `json:"dtls_parameters" mapstructure:"dtls_parameters"`
	SctpParameters *mediasoup.SctpParameters `json:"sctp_parameters" mapstructure:"sctp_parameters"`
}

type CloseTransportReqData struct {
	RouterId    string `json:"router_id" mapstructure:"router_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
}

type CloseTransportResData struct {
	RouterId    string `json:"router_id" mapstructure:"router_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
}

type ConnectTransportReqData struct {
	RouterId       string                    `json:"router_id" mapstructure:"router_id"`
	TransportType  string                    `json:"transport_type" mapstructure:"transport_type"`
	TransportId    string                    `json:"transport_id" mapstructure:"transport_id"`
	DtlsParameters *mediasoup.DtlsParameters `json:"dtls_parameters" mapstructure:"dtls_parameters"`
}

type CreateProducerReqData struct {
	RouterId      string                   `json:"router_id" mapstructure:"router_id"`
	TransportId   string                   `json:"transport_id" mapstructure:"transport_id"`
	Kind          mediasoup.MediaKind      `json:"kind" mapstructure:"kind"`
	RtpParameters *mediasoup.RtpParameters `json:"rtp_parameters" mapstructure:"rtp_parameters"`
	AppData       mediasoup.H              `json:"app_data" mapstructure:"app_data"`
}

type CreateProducerResData struct {
	RouterId   string `json:"router_id" mapstructure:"router_id"`
	ProducerId string `json:"producer_id" mapstructure:"producer_id"`
}

type CloseProducerReqData struct {
	RouterId    string `json:"router_id" mapstructure:"router_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
	ProducerId  string `json:"producer_id" mapstructure:"producer_id"`
}

type CloseProducerResData struct {
	RouterId    string `json:"router_id" mapstructure:"router_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
	ProducerId  string `json:"producer_id" mapstructure:"producer_id"`
}

type CreateConsumerReqData struct {
	RouterId    string                     `json:"router_id" mapstructure:"router_id"`
	TransportId string                     `json:"transport_id" mapstructure:"transport_id"`
	ProducerId  string                     `json:"producer_id" mapstructure:"producer_id"`
	Kind        mediasoup.MediaKind        `json:"kind" mapstructure:"kind"`
	RtpCaps     *mediasoup.RtpCapabilities `json:"rtp_caps" mapstructure:"rtp_caps"`
	AppData     mediasoup.H                `json:"app_data" mapstructure:"app_data"`
}

type CreateConsumerResData struct {
	RouterId      string                   `json:"router_id" mapstructure:"router_id"`
	ProducerId    string                   `json:"producer_id" mapstructure:"producer_id"`
	ConsumerId    string                   `json:"consumer_id" mapstructure:"consumer_id"`
	Kind          mediasoup.MediaKind      `json:"kind" mapstructure:"kind"`
	RtpParameters *mediasoup.RtpParameters `json:"rtp_parameters" mapstructure:"rtp_parameters"`
	AppData       mediasoup.H              `json:"app_data" mapstructure:"app_data"`
}

type CloseConsumerReqData struct {
	RouterId    string `json:"router_id" mapstructure:"router_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
	ConsumerId  string `json:"consumer_id" mapstructure:"consumer_id"`
}

type CloseConsumerResData struct {
	RouterId    string `json:"router_id" mapstructure:"router_id"`
	TransportId string `json:"transport_id" mapstructure:"transport_id"`
	ConsumerId  string `json:"consumer_id" mapstructure:"consumer_id"`
}
